package net.yla.smartbus.module.controller.web.ba.right.setting;

import net.yla.smartbus.core.api.ApiResult;
import net.yla.smartbus.core.base.BaseController;
import net.yla.smartbus.module.ba.right.setting.query.SettingQuery;
import net.yla.smartbus.module.ba.right.setting.service.SettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Date: 2020-08-29 9:39
 * @Author: Being Nobody
 * @Version: 1.0
 */
@RestController
@RequestMapping("/api/web/settings")
public class SettingController extends BaseController {

    @Autowired
    private SettingsService settingsService;

    /**
     * 获取系统配置设置
     * name与URL、PlatformId字段组合唯一。
     *
     * @param query
     * @return
     */
    @PostMapping("/get")
    private ApiResult get(@RequestBody SettingQuery query) {
        return success(settingsService.get(query));
    }

    /**
     * 设置系统配置设置
     *
     * @param query
     * @return
     */
    @PostMapping("/set")
    private ApiResult set(@RequestBody SettingQuery query) {
        return success(settingsService.set(query));
    }
}
